package com.yozinga.util;

import android.R.bool;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class SharedData {
	private SharedPreferences sharedPreferences;
	Context mContext;
	Editor preferences_Editor;

	public SharedData(Context context) {
		this.mContext = context;
		sharedPreferences = mContext.getSharedPreferences(AppData.SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
	}

	public void setDeviceSettings(String startTime,String endTime,boolean pushNotification,String radius){
		preferences_Editor = sharedPreferences.edit();
		preferences_Editor.putString("startTime",startTime);
		preferences_Editor.putString("endTime", endTime);
		preferences_Editor.putBoolean("pushNotification",pushNotification);
		preferences_Editor.putString("radius", radius);
		preferences_Editor.commit();
	}

	public String getStartTime(){
		return sharedPreferences.getString("startTime", "");
	}

	public String getEndTime(){
		return sharedPreferences.getString("endTime", "");
	}

	public boolean getpushNotification(){
		return sharedPreferences.getBoolean("pushNotification", false);
	}

	public String getRadius(){
		return sharedPreferences.getString("radius", "100");
	}

	public void setTwitterStatus(String status){
		preferences_Editor = sharedPreferences.edit();
		preferences_Editor.putString("twitterStatus",status);
		preferences_Editor.commit();
	}

	public String getTwitterStaus(){
		return sharedPreferences.getString("twitterStatus", "Great Deal");
	}


	public void setLocationValues(String latitude,String longitude){
		preferences_Editor = sharedPreferences.edit();
		preferences_Editor.putString("latitude",latitude);
		preferences_Editor.putString("longitude", longitude);
		preferences_Editor.commit();
	}

	public String getLatitude(){
		return sharedPreferences.getString("latitude", "null");
	}
	public String getLongitude(){
		return sharedPreferences.getString("longitude", "null");
	}
	
	public void setBusinessTypes(String businessType,String id){
		preferences_Editor = sharedPreferences.edit();
		preferences_Editor.putString(businessType,id);
		preferences_Editor.commit();
	}
	
	public String getBusinessId(String BusinessName){
		return sharedPreferences.getString(BusinessName,"");
	}
	
	public void setTwitter(Boolean value){
		preferences_Editor = sharedPreferences.edit();
		preferences_Editor.putBoolean("twitter",value);
		preferences_Editor.commit();
	}
	
	public Boolean getTwitter(){
		return sharedPreferences.getBoolean("twitter",true);
	}
}

